package Thread;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class ThreadDemo28 {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(100);
        //带阻塞功能的
        queue.put("aaa");
        String elem = queue.take();
        System.out.println("elem:"+elem);
        String elem1 = queue.take();//阻塞
        System.out.println("elem:"+elem);
        //没有阻塞的获取队首元素的方法
    }
}
